| Name | Description |
|---|---|
| Record defining a Complex number | |
| Record defining the data for a polynomial | |
| Additional functions for Modelica.Math | |
| Functions operating on vectors |
Modelica_LinearSystems2.Math.Complex
This record defines a complex number consisting of a real and an imaginary part. Additionally, various utility functions are provided in the record to operate on instances of this record. Example (note: "j" in the comments is defined as j=sqrt(-1)):
import Modelica.Utilities.Streams;
import Modelica_LinearSystems2.Math.Complex;
Complex c1=Complex(re=2, im=3) "= 2 + 3j";
Complex c2=Complex(3,4) "= 3 + 4j";
algorithm
c3 := Complex.'+'(c1, c2) "= c1 + c2";
Streams.print("c3 = " + Complex.'String'(c3));
Streams.print("c3 = " + Complex.'String'(c3,"i"));
// This gives the following print-out:
c3 = 5 + 7j
c3 = 5 + 7i
The utility functions are written in such a way that it is convenient to work with them, once operator overloading is provided in Modelica and Modelica tools. Example:
// Assume operator overloading is available (this is not yet the case): Complex j = Complex.j(); Complex c4 = -2 + 5*j; // A Modelica tool will transform the statement of c4 into Complex c4 = Complex.'+'( Complex.(-2,0), Complex.'*'(Complex(5,0),j)));
The utility functions are implemented so that they can be easily inlined by a tool. In such a case, the above statement will not lead to any overhead.
Extends from Modelica.Icons.Record (Icon for a record).
| Name | Description |
|---|---|
| re | Real part of complex number |
| im | Imaginary part of complex number |
Modelica_LinearSystems2.Math.Polynomial
This record defines a polynomial, e.g., y = 2*x^2 + 3*x + 1. The general form is:
y = c[1]*x^n + c[2]*x^(n-1) + ... + c[n]*x + c[n+1];
In the record, the coefficients c[i] are stored. Usually, the record is not directly accessed. Instead, a polynomial is generated with the functions provided in the record such as Polynomial.base(..), Polynomial.fitting(..). Several functions are provided that operate on polynomials.
Extends from Modelica.Icons.Record (Icon for a record).
| Name | Description |
|---|---|
| c[:] | Polynomial coefficients (c[1]*x^n + ... c[n]*x + c[n+1]) |